local zhubei = fk.CreateSkill{
  name = "hanqing__zhubei",
}

Fk:loadTranslationTable{
  ["hanqing__zhubei"] = "逐北",
  [":hanqing__zhubei"] = "出牌阶段限一次，你可以展示中央区一张伤害牌，令一名体力值小于你的角色选择是否交给你一张点数大于此牌的基本牌，否则"..
  "你视为对其使用之。",

  ["#hanqing__zhubei"] = "逐北：展示中央区一张伤害牌，令一名角色选择交给你一张点数更大的基本牌或视为你对其使用之",
  ["#hanqing__zhubei-give"] = "逐北：请交给 %src 一张点数大于%arg的基本牌，否则视为其对你使用【%arg2】",
}

zhubei:addEffect("active", {
  anim_type = "offensive",
  card_num = 1,
  target_num = 1,
  prompt = "#hanqing__zhubei",
  expand_pile = function (self, player)
    return Fk:currentRoom():getBanner("@$CenterArea")
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(zhubei.name, Player.HistoryPhase) == 0 and
      table.find(Fk:currentRoom():getBanner("@$CenterArea"), function (id)
        return Fk:getCardById(id).is_damage_card
      end)
  end,
  card_filter = function (self, player, to_select, selected)
    return #selected == 0 and table.contains(Fk:currentRoom():getBanner("@$CenterArea"), to_select) and
      Fk:getCardById(to_select).is_damage_card
  end,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and player.hp > to_select.hp
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:showCards(effect.cards)
    if player.dead or target.dead then return end
    local n = Fk:getCardById(effect.cards[1]).number
    local name = Fk:getCardById(effect.cards[1]).name
    local card = room:askToCards(target, {
      min_num = 1,
      max_num = 1,
      include_equip = false,
      skill_name = zhubei.name,
      pattern = ".|"..(n + 1).."~13|.|.|.|basic",
      prompt = "#hanqing__zhubei-give:"..player.id.."::"..n..":"..name,
      cancelable = true,
    })
    if #card > 0 then
      room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonGive, zhubei.name, nil, true, target)
    else
      room:useVirtualCard(name, nil, player, target, zhubei.name, true)
    end
  end,
})

zhubei:addAcquireEffect(function (self, player, is_start)
  player.room:addSkill("#CenterArea")
end)

return zhubei
